/**
 * 深度冻结对象
 * @param obj 要冻结的对象
 */
export const deepFreeze = (obj: unknown) => {
  if (typeof obj === 'object' && obj !== null && !Object.isFrozen(obj)) {
    Object.freeze(obj)
    Object.values(obj).forEach(val => {
      if (typeof val === 'object' && val !== null && !Object.isFrozen(val)) {
        deepFreeze(val)
      }
    })
  }
}
